package org.wk.account.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.wk.account.domain.ling.SubAccountLingExchangeCNY;
import org.wk.account.domain.zuan.SubAccountZuanExchangeCNY;
import org.wk.account.service.SubAccountZuanService;
import org.wk.account.view.LingExchangeCNYVo;
import org.wk.account.view.ZuanExchangeCNYVo;
import org.wk.core.common.view.PageVo;
import org.wk.core.common.view.ResponseVo;
import org.wk.logger.common.annotation.SysLog;

import java.util.Map;

/**
 * @ClassName ZuanExchangeCNYController
 * @Description
 * @Author ZhaoPing'an
 * @Date 2018/7/2 14:48
 */
@RestController
@RequestMapping("/exchangeCNY")
public class ZuanExchangeCNYController {

    @Autowired
    private SubAccountZuanService zuanService;

    @SysLog("鲸钻提现管理")
    @RequestMapping(value="/zuan/list",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseVo list(@RequestParam Map<String, Object> params){
        PageVo page = zuanService.findExchangeCNYListPage(params);
        return ResponseVo.success().addAttribute("page", page);
    }

    /**
     * @Description 已打款
     * @param
     * @author ZhaoPing'an
     * @Date 2018/7/2 16:17
     */
    @SysLog("鲸灵提现已打款操作")
    @RequestMapping(value="/zuan/successExchangeCNY")
    public ResponseVo successExchangeCNY(@RequestBody SubAccountZuanExchangeCNY zuanExchangeCNY){
        ResponseVo result = zuanService.successExchangeCNY(zuanExchangeCNY.getId());
        return result;
    }

    @SysLog("鲸灵提现拒绝操作")
    @RequestMapping(value="/zuan/refuseExchangeCNY")
    public ResponseVo refuseExchangeCNY(@RequestBody ZuanExchangeCNYVo zuanExchangeCNYVo){
        ResponseVo result = zuanService.refuseExchangeCNY(zuanExchangeCNYVo);
        return result;
    }
}
